1. Field of the Invention
This invention relates to a ternary CAM.
2. Related Art
In computer networks for transmitting information, routing devices are used to process incoming messages and to determine the disposition for those messages. Most messages are ultimately forwarded to their destination, using routing information maintained at the router and used in response to routing information contained in a header for the message.
One problem in the known art is that the task of processing incoming messages by the router can take substantial time. Performing additional functions besides forwarding could also increase the amount of processing time. These additional functions can include access control, quality of service features, and implementing other administrative policies. Accordingly, it would be advantageous to reduce the amount of processing time used by the router, so as to be able to route more messages in each unit time.
One known solution is to organize routing information in the router so it can be readily accessed, such as using a tree structure, a trie structure, or a hash table. While these methods of data access are relatively quick, they still take an amount of time that grows with the number of possible different selections. For example, some of these methods take about O(log N) time to perform, where N is the number of possible different selections. When the number of possible different selections is large, this can represent a substantial amount of processing time for each message. These methods of data access also have the drawback that they take variable amounts of time. This makes allocating processing time, queueing space, and other router (or switch) resources more difficult. Accordingly, it would be advantageous to be able to process each message in a known bounded time, such as O(constant) time.
One idea with promise is to use a CAM (content addressable memory) to match key information from each incoming message with a disposition for that message. However, the information used for routing has a great deal of redundancy. Having one entry in the CAM for each possible set of routing information (or even for each set of routing information known to the router), the CAM would need to be unduly large and unwieldy. Accordingly, it would be desirable to have one entry in the CAM stand for multiple sets of routing information.
One known method by which each CAM entry can stand for multiple sets of information is to provide a ternary CAM, that is, one in which each bit entry for matching is either a logical xe2x80x9c0,xe2x80x9d a logical xe2x80x9c1,xe2x80x9d or a logical xe2x80x9cdon""t care.xe2x80x9d In known ternary CAMs, each entry for matching comprises two bits for each value bit, a first bit to indicate whether the bit need be matched at all, and a second bit to indicate (if matched) to what value the bit must match. However, by providing a mask bit for each value bit (thus, two bits total for each value bit) these known ternary CAMs have a relatively large amount of overhead. This limits the maximum size of the CAM that can be implemented in a selected chip area with a selected manufacturing technology.
Accordingly, it would be desirable to provide a method and system for flexible matching of data in a CAM that does not use the overhead of one mask bit for each matched value bit. This advantage is achieved in an embodiment of the invention in which the entries of the CAM are logically grouped in a set of blocks, each block having a single mask that applies to all entries in the block.
The invention provides a method and system for flexible matching of data in a CAM that does not use the overhead of one mask bit for each matched value bit. The entries of the CAM are logically grouped in a set of blocks, each block having a single mask that applies to all entries in the block. In a preferred embodiment, each block includes a predetermined number of CAM entries, such as a block of sixteen entries. However, in alternative embodiments, the number of CAM entries for each block could be predetermined to be a different number, or could be dynamically selected with the values that are entered into the CAM.